package com.openstack4j.qx.imp;

import java.util.List;
import java.util.Stack;

import org.openstack4j.api.Builders;
import org.openstack4j.api.OSClient.OSClientV2;
import org.openstack4j.api.compute.ServerService;
import org.openstack4j.model.storage.block.Volume;
import org.openstack4j.model.storage.block.Volume.Status;
import org.openstack4j.model.storage.block.VolumeAttachment;
import org.openstack4j.openstack.OSFactory;
import org.openstack4j.openstack.compute.internal.ServerServiceImpl;

import com.openstack4j.qx.BSController;
import com.openstack4j.qx.pojo.BaseResp;

public class Test {

	public static void main(String[] args) {
		//登录
		OSClientV2 os = OSFactory.builderV2()
                .endpoint("http://10.50.0.10:5000/v2.0")
	            .credentials("admin","ADMIN_PASS")
	            .tenantName("admin")
	            .authenticate();
			System.out.println("authentication complate");
				
		
		Volume volume = os.blockStorage().volumes().get("0b1bfff3-3b5e-445b-baca-d93f76a3d3f8");
	
	
		
		
		List<? extends VolumeAttachment> attach = volume.getAttachments();
		for(VolumeAttachment va:attach){
			System.out.println(va.getId());
		}
		
		
		System.out.println(volume.getStatus());
		 
//		List<? extends Volume> volumes = os.blockStorage().volumes().list();
//		for(Volume v:volumes){
//			System.out.println(v);
//		}
		
		BSController b=new BSControllerImp();
		BaseResp baseResp = b.UpdateBS("861d091a-51a2-498b-81b0-97a1f5fab3e9", 2, "跟新的");
		System.out.println(baseResp.getFaultstring());
	}

}
